how to find lcm in python using loop